<?php
function ip() {
    return $_SERVER['HTTP_X_FORWARDED_FOR'];
}

$myfile = fopen("count.txt", "a") or die("Unable to open file!");
fwrite($myfile, ip()."\r\n");
fclose($myfile);
echo ip();//'success';
?>